<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>switch语句</title>
    
</head>
<body>
    <script type="text/javascript">
        var weather = 'rainy'
        // 编写switch语句 小心break case穿透
        switch (weather) {
            case 'sunny':
                alert(1)
                break;
            case 'rainy':
                alert(2)
                break;
            default:
                alert(3)
                break;
        }
    </script>
</body>
</html>